class Result {
    code
    success
    data
    msg

    constructor({code, success, data, msg}={}) {
        this.success = success
        this.code = code
        this.data = data
        this.msg = msg
    }

    succ(data, msg = '成功') {
        return new Result({success: true, code: '001', data, msg})
    }

    fail(msg = '失败') {
        return new Result({
            success: false,
            code: '003',
            data:null, msg
        })
    }
}
module.exports ={Result}
